package net.m2technologies.open_arm.metric;

import net.m2technologies.open_arm.transaction.ArmInterfaceImpl;
import org.opengroup.arm40.metric.ArmMetric;
import org.opengroup.arm40.metric.ArmMetricDefinition;
import org.opengroup.arm40.transaction.ArmTransactionFactory;

/**
 * Copyright 2005 Mark Masterson<br> <br> Licensed under the Apache License, Version 2.0 (the "License");<br> you may
 * not use this file except in compliance with the License.<br> You may obtain a copy of the License at<br> <br>
 * http://www.apache.org/licenses/LICENSE-2.0<br> <br> Unless required by applicable law or agreed to in writing,
 * software<br> distributed under the License is distributed on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS
 * OF ANY KIND, either express or implied.<br> See the License for the specific language governing permissions and<br>
 * limitations under the License.<br>
 * <p/>
 * <p>Description: </p>
 *
 * @author Mark Masterson
 * @version 0.010
 */
public class ArmMetricImpl extends ArmInterfaceImpl implements ArmMetric {

    private final ArmMetricDefinition metricDefinition;

    public ArmMetricImpl(final ArmTransactionFactory creatingFactory, final ArmMetricDefinition metricDefinition) {
        super(creatingFactory);
        this.metricDefinition = metricDefinition;
    }

    public ArmMetricDefinition getDefinition() {
        return this.metricDefinition;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof ArmMetric)) {
            return false;
        }

        final ArmMetricImpl armMetric = (ArmMetricImpl) o;

        if (!metricDefinition.equals(armMetric.metricDefinition)) {
            return false;
        }

        return true;
    }

    public int hashCode() {
        return metricDefinition.hashCode();
    }
}
